home *** CD-ROM | disk | FTP | other *** search
- --
- -- Run this script to record the locations of all icons on your desktop. Once recorded,
- -- you can use the Restore Desktop script to restore all icons to their original positions.
- --
-
- on writeFile(theFile, theData)
- local fileRef
-
- set fileRef to open for access theFile with write permission
- try
- set eof fileRef to 0
- write theData to fileRef
- close access fileRef
- on error errMsg number errNum
- close access fileRef
- error errMsg number errNum
- end try
- end writeFile
-
- on saveDesktop()
- local outFile, theXML
-
- set outFile to new file
-
- set theXML to {"<desktop>" & return}
- tell application "Finder"
- repeat with anItem in items of desktop
- if class of anItem is not disk then
- set thePosition to position of anItem
- set end of theXML to (tab & "<item name=\"" & ¬
- (name of anItem) & "\" h=\"" & ¬
- (item 1 of thePosition) & "\" v=\"" & ¬
- (item 2 of thePosition) & "\"/>" & return)
- end if
- end repeat
- end tell
- set end of theXML to ("</desktop>" & return)
-
- writeFile(outFile, theXML as string)
- end saveDesktop
-
- saveDesktop()